<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos -->
			<title>File Source for OAuth.php</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
		</head>
		<body>
						<h1>Source for file OAuth.php</h1>
<p>Documentation is available at <a href="../OAuth/_OAuth.php.html">OAuth.php</a></p>
<div class="src-code">
<div class="src-code"><ol><li><div class="src-line"><a name="a1"></a><span class="src-php">&lt;?php</span></div></li>
<li><div class="src-line"><a name="a2"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a3"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a4"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a5"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@package</span><span class="src-doc">&nbsp;OAuth</span></div></li>
<li><div class="src-line"><a name="a6"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@license</span><span class="src-doc">&nbsp;MIT&nbsp;License&nbsp;(http://www.opensource.org/licenses/mit-license.php)</span></div></li>
<li><div class="src-line"><a name="a7"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a8"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;The&nbsp;MIT&nbsp;License</span></div></li>
<li><div class="src-line"><a name="a9"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a10"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;Copyright&nbsp;(c)&nbsp;2007&nbsp;Andy&nbsp;Smith</span></div></li>
<li><div class="src-line"><a name="a11"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a12"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;Permission&nbsp;is&nbsp;hereby&nbsp;granted,&nbsp;free&nbsp;of&nbsp;charge,&nbsp;to&nbsp;any&nbsp;person&nbsp;obtaining&nbsp;a&nbsp;copy</span></div></li>
<li><div class="src-line"><a name="a13"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;of&nbsp;this&nbsp;software&nbsp;and&nbsp;associated&nbsp;documentation&nbsp;files&nbsp;(the&nbsp;&quot;Software&quot;),&nbsp;to&nbsp;deal</span></div></li>
<li><div class="src-line"><a name="a14"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;in&nbsp;the&nbsp;Software&nbsp;without&nbsp;restriction,&nbsp;including&nbsp;without&nbsp;limitation&nbsp;the&nbsp;rights</span></div></li>
<li><div class="src-line"><a name="a15"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;to&nbsp;use,&nbsp;copy,&nbsp;modify,&nbsp;merge,&nbsp;publish,&nbsp;distribute,&nbsp;sublicense,&nbsp;and/or&nbsp;sell</span></div></li>
<li><div class="src-line"><a name="a16"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;copies&nbsp;of&nbsp;the&nbsp;Software,&nbsp;and&nbsp;to&nbsp;permit&nbsp;persons&nbsp;to&nbsp;whom&nbsp;the&nbsp;Software&nbsp;is</span></div></li>
<li><div class="src-line"><a name="a17"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;furnished&nbsp;to&nbsp;do&nbsp;so,&nbsp;subject&nbsp;to&nbsp;the&nbsp;following&nbsp;conditions:</span></div></li>
<li><div class="src-line"><a name="a18"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a19"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;The&nbsp;above&nbsp;copyright&nbsp;notice&nbsp;and&nbsp;this&nbsp;permission&nbsp;notice&nbsp;shall&nbsp;be&nbsp;included&nbsp;in</span></div></li>
<li><div class="src-line"><a name="a20"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;all&nbsp;copies&nbsp;or&nbsp;substantial&nbsp;portions&nbsp;of&nbsp;the&nbsp;Software.</span></div></li>
<li><div class="src-line"><a name="a21"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a22"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;THE&nbsp;SOFTWARE&nbsp;IS&nbsp;PROVIDED&nbsp;&quot;AS&nbsp;IS&quot;,&nbsp;WITHOUT&nbsp;WARRANTY&nbsp;OF&nbsp;ANY&nbsp;KIND,&nbsp;EXPRESS&nbsp;OR</span></div></li>
<li><div class="src-line"><a name="a23"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;IMPLIED,&nbsp;INCLUDING&nbsp;BUT&nbsp;NOT&nbsp;LIMITED&nbsp;TO&nbsp;THE&nbsp;WARRANTIES&nbsp;OF&nbsp;MERCHANTABILITY,</span></div></li>
<li><div class="src-line"><a name="a24"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;FITNESS&nbsp;FOR&nbsp;A&nbsp;PARTICULAR&nbsp;PURPOSE&nbsp;AND&nbsp;NONINFRINGEMENT.&nbsp;IN&nbsp;NO&nbsp;EVENT&nbsp;SHALL&nbsp;THE</span></div></li>
<li><div class="src-line"><a name="a25"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;AUTHORS&nbsp;OR&nbsp;COPYRIGHT&nbsp;HOLDERS&nbsp;BE&nbsp;LIABLE&nbsp;FOR&nbsp;ANY&nbsp;CLAIM,&nbsp;DAMAGES&nbsp;OR&nbsp;OTHER</span></div></li>
<li><div class="src-line"><a name="a26"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;LIABILITY,&nbsp;WHETHER&nbsp;IN&nbsp;AN&nbsp;ACTION&nbsp;OF&nbsp;CONTRACT,&nbsp;TORT&nbsp;OR&nbsp;OTHERWISE,&nbsp;ARISING&nbsp;FROM,</span></div></li>
<li><div class="src-line"><a name="a27"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;OUT&nbsp;OF&nbsp;OR&nbsp;IN&nbsp;CONNECTION&nbsp;WITH&nbsp;THE&nbsp;SOFTWARE&nbsp;OR&nbsp;THE&nbsp;USE&nbsp;OR&nbsp;OTHER&nbsp;DEALINGS&nbsp;IN</span></div></li>
<li><div class="src-line"><a name="a28"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;THE&nbsp;SOFTWARE.</span></div></li>
<li><div class="src-line"><a name="a29"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a30"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a31"></a><span class="src-key">class&nbsp;</span><a href="../OAuth/OAuthConsumer.html">OAuthConsumer</a>&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a32"></a>&nbsp;&nbsp;<span class="src-key">var&nbsp;</span><a href="../OAuth/OAuthConsumer.html#var$key">$key</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a33"></a>&nbsp;&nbsp;<span class="src-key">var&nbsp;</span><a href="../OAuth/OAuthConsumer.html#var$secret">$secret</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a34"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a35"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthConsumer.html#methodOAuthConsumer">OAuthConsumer</a><span class="src-sym">(</span><span class="src-var">$key</span><span class="src-sym">,&nbsp;</span><span class="src-var">$secret</span><span class="src-sym">,&nbsp;</span><span class="src-var">$callback_url</span>=<span class="src-id">NULL</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a36"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthConsumer.html#var$key">key</a>&nbsp;=&nbsp;<span class="src-var">$key</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a37"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthConsumer.html#var$secret">secret</a>&nbsp;=&nbsp;<span class="src-var">$secret</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a38"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">callback_url&nbsp;</span>=&nbsp;<span class="src-var">$callback_url</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a39"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a40"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a41"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthConsumer.html#method__toString">__toString</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a42"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-str">&quot;</span><span class="src-str">OAuthConsumer[key=<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthConsumer.html#var$key">key</a>,secret=<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthConsumer.html#var$secret">secret</a>]</span><span class="src-str">&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a43"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a44"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a45"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a46"></a><span class="src-key">class&nbsp;</span><a href="../OAuth/OAuthToken.html">OAuthToken</a>&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a47"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;access&nbsp;tokens&nbsp;and&nbsp;request&nbsp;tokens</span></div></li>
<li><div class="src-line"><a name="a48"></a>&nbsp;&nbsp;<span class="src-key">var&nbsp;</span><a href="../OAuth/OAuthToken.html#var$key">$key</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a49"></a>&nbsp;&nbsp;<span class="src-key">var&nbsp;</span><a href="../OAuth/OAuthToken.html#var$secret">$secret</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a50"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a51"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a52"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;key&nbsp;=&nbsp;the&nbsp;token</span></div></li>
<li><div class="src-line"><a name="a53"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;secret&nbsp;=&nbsp;the&nbsp;token&nbsp;secret</span></div></li>
<li><div class="src-line"><a name="a54"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a55"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthToken.html#methodOAuthToken">OAuthToken</a><span class="src-sym">(</span><span class="src-var">$key</span><span class="src-sym">,&nbsp;</span><span class="src-var">$secret</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a56"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthToken.html#var$key">key</a>&nbsp;=&nbsp;<span class="src-var">$key</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a57"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthToken.html#var$secret">secret</a>&nbsp;=&nbsp;<span class="src-var">$secret</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a58"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a59"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a60"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a61"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;generates&nbsp;the&nbsp;basic&nbsp;string&nbsp;serialization&nbsp;of&nbsp;a&nbsp;token&nbsp;that&nbsp;a&nbsp;server</span></div></li>
<li><div class="src-line"><a name="a62"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;would&nbsp;respond&nbsp;to&nbsp;request_token&nbsp;and&nbsp;access_token&nbsp;calls&nbsp;with</span></div></li>
<li><div class="src-line"><a name="a63"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a64"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthToken.html#methodto_string">to_string</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a65"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-str">&quot;oauth_token=&quot;&nbsp;</span>.&nbsp;<span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodurlencode_rfc3986">urlencode_rfc3986</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthToken.html#var$key">key</a><span class="src-sym">)&nbsp;</span>.</div></li>
<li><div class="src-line"><a name="a66"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">&quot;&amp;oauth_token_secret=&quot;&nbsp;</span>.&nbsp;<span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodurlencode_rfc3986">urlencode_rfc3986</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthToken.html#var$secret">secret</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a67"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a68"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a69"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthToken.html#method__toString">__toString</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a70"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthToken.html#methodto_string">to_string</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a71"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a72"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a73"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a74"></a><span class="src-key">class&nbsp;</span><a href="../OAuth/OAuthSignatureMethod.html">OAuthSignatureMethod</a>&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a75"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthSignatureMethod.html#methodcheck_signature">check_signature</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$request</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">,&nbsp;</span><span class="src-var">$signature</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a76"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$built&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">build_signature</span><span class="src-sym">(</span><span class="src-var">$request</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a77"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$built&nbsp;</span>==&nbsp;<span class="src-var">$signature</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a78"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a79"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a80"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a81"></a><span class="src-key">class&nbsp;</span><a href="../OAuth/OAuthSignatureMethod_HMAC_SHA1.html">OAuthSignatureMethod_HMAC_SHA1</a>&nbsp;<span class="src-key">extends&nbsp;</span><a href="../OAuth/OAuthSignatureMethod.html">OAuthSignatureMethod</a>&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a82"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthSignatureMethod_HMAC_SHA1.html#methodget_name">get_name</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a83"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-str">&quot;HMAC-SHA1&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a84"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a85"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a86"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthSignatureMethod_HMAC_SHA1.html#methodbuild_signature">build_signature</a><span class="src-sym">(</span><span class="src-var">$request</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a87"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$base_string&nbsp;</span>=&nbsp;<span class="src-var">$request</span><span class="src-sym">-&gt;</span><span class="src-id">get_signature_base_string</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a88"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$request</span><span class="src-sym">-&gt;</span><span class="src-id">base_string&nbsp;</span>=&nbsp;<span class="src-var">$base_string</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a89"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a90"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$key_parts&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span></div></li>
<li><div class="src-line"><a name="a91"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$consumer</span><span class="src-sym">-&gt;</span><span class="src-id">secret</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a92"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(</span><span class="src-var">$token</span><span class="src-sym">)&nbsp;</span>?&nbsp;<span class="src-var">$token</span><span class="src-sym">-&gt;</span><span class="src-id">secret&nbsp;</span>:&nbsp;<span class="src-str">&quot;&quot;</span></div></li>
<li><div class="src-line"><a name="a93"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a94"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a95"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$key_parts&nbsp;</span>=&nbsp;<span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodurlencode_rfc3986">urlencode_rfc3986</a><span class="src-sym">(</span><span class="src-var">$key_parts</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a96"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$key&nbsp;</span>=&nbsp;<a href="http://www.php.net/implode">implode</a><span class="src-sym">(</span><span class="src-str">'&amp;'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$key_parts</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a97"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a98"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/base64_encode">base64_encode</a><span class="src-sym">(&nbsp;</span><a href="../OAuth/_OAuth.php.html#functionhash_hmac">hash_hmac</a><span class="src-sym">(</span><span class="src-str">'sha1'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$base_string</span><span class="src-sym">,&nbsp;</span><span class="src-var">$key</span><span class="src-sym">,&nbsp;</span><span class="src-id">true</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a99"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a100"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a101"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a102"></a><span class="src-key">class&nbsp;</span><a href="../OAuth/OAuthSignatureMethod_PLAINTEXT.html">OAuthSignatureMethod_PLAINTEXT</a>&nbsp;<span class="src-key">extends&nbsp;</span><a href="../OAuth/OAuthSignatureMethod.html">OAuthSignatureMethod</a>&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a103"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthSignatureMethod_PLAINTEXT.html#methodget_name">get_name</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a104"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-str">&quot;PLAINTEXT&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a105"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a106"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a107"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthSignatureMethod_PLAINTEXT.html#methodbuild_signature">build_signature</a><span class="src-sym">(</span><span class="src-var">$request</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a108"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$sig&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span></div></li>
<li><div class="src-line"><a name="a109"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodurlencode_rfc3986">urlencode_rfc3986</a><span class="src-sym">(</span><span class="src-var">$consumer</span><span class="src-sym">-&gt;</span><span class="src-id">secret</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a110"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a111"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a112"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$token</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a113"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/array_push">array_push</a><span class="src-sym">(</span><span class="src-var">$sig</span><span class="src-sym">,&nbsp;</span><span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodurlencode_rfc3986">urlencode_rfc3986</a><span class="src-sym">(</span><span class="src-var">$token</span><span class="src-sym">-&gt;</span><span class="src-id">secret</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a114"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a115"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/array_push">array_push</a><span class="src-sym">(</span><span class="src-var">$sig</span><span class="src-sym">,&nbsp;</span><span class="src-str">''</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a116"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a117"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a118"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$raw&nbsp;</span>=&nbsp;<a href="http://www.php.net/implode">implode</a><span class="src-sym">(</span><span class="src-str">&quot;&amp;&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$sig</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a119"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;for&nbsp;debug&nbsp;purposes</span></div></li>
<li><div class="src-line"><a name="a120"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$request</span><span class="src-sym">-&gt;</span><span class="src-id">base_string&nbsp;</span>=&nbsp;<span class="src-var">$raw</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a121"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a122"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodurlencode_rfc3986">urlencode_rfc3986</a><span class="src-sym">(</span><span class="src-var">$raw</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a123"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a124"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a125"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a126"></a><span class="src-key">class&nbsp;</span><a href="../OAuth/OAuthSignatureMethod_RSA_SHA1.html">OAuthSignatureMethod_RSA_SHA1</a>&nbsp;<span class="src-key">extends&nbsp;</span><a href="../OAuth/OAuthSignatureMethod.html">OAuthSignatureMethod</a>&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a127"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthSignatureMethod_RSA_SHA1.html#methodget_name">get_name</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a128"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-str">&quot;RSA-SHA1&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a129"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a130"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a131"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthSignatureMethod_RSA_SHA1.html#methodfetch_public_cert">fetch_public_cert</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$request</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a132"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;not&nbsp;implemented&nbsp;yet,&nbsp;ideas&nbsp;are:</span></div></li>
<li><div class="src-line"><a name="a133"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;(1)&nbsp;do&nbsp;a&nbsp;lookup&nbsp;in&nbsp;a&nbsp;table&nbsp;of&nbsp;trusted&nbsp;certs&nbsp;keyed&nbsp;off&nbsp;of&nbsp;consumer</span></div></li>
<li><div class="src-line"><a name="a134"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;(2)&nbsp;fetch&nbsp;via&nbsp;http&nbsp;using&nbsp;a&nbsp;url&nbsp;provided&nbsp;by&nbsp;the&nbsp;requester</span></div></li>
<li><div class="src-line"><a name="a135"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;(3)&nbsp;some&nbsp;sort&nbsp;of&nbsp;specific&nbsp;discovery&nbsp;code&nbsp;based&nbsp;on&nbsp;request</span></div></li>
<li><div class="src-line"><a name="a136"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//</span></div></li>
<li><div class="src-line"><a name="a137"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;either&nbsp;way&nbsp;should&nbsp;return&nbsp;a&nbsp;string&nbsp;representation&nbsp;of&nbsp;the&nbsp;certificate</span></div></li>
<li><div class="src-line"><a name="a138"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/trigger_error">trigger_error</a><span class="src-sym">(</span><span class="src-str">&quot;fetch_public_cert&nbsp;not&nbsp;implemented&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-id">E_USER_WARNING</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a139"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a140"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a141"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a142"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthSignatureMethod_RSA_SHA1.html#methodfetch_private_cert">fetch_private_cert</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$request</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a143"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;not&nbsp;implemented&nbsp;yet,&nbsp;ideas&nbsp;are:</span></div></li>
<li><div class="src-line"><a name="a144"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;(1)&nbsp;do&nbsp;a&nbsp;lookup&nbsp;in&nbsp;a&nbsp;table&nbsp;of&nbsp;trusted&nbsp;certs&nbsp;keyed&nbsp;off&nbsp;of&nbsp;consumer</span></div></li>
<li><div class="src-line"><a name="a145"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//</span></div></li>
<li><div class="src-line"><a name="a146"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;either&nbsp;way&nbsp;should&nbsp;return&nbsp;a&nbsp;string&nbsp;representation&nbsp;of&nbsp;the&nbsp;certificate</span></div></li>
<li><div class="src-line"><a name="a147"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/trigger_error">trigger_error</a><span class="src-sym">(</span><span class="src-str">&quot;fetch_private_cert&nbsp;not&nbsp;implemented&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-id">E_USER_WARNING</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a148"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a149"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a150"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a151"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthSignatureMethod_RSA_SHA1.html#methodbuild_signature">build_signature</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$request</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a152"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$base_string&nbsp;</span>=&nbsp;<span class="src-var">$request</span><span class="src-sym">-&gt;</span><span class="src-id">get_signature_base_string</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a153"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$request</span><span class="src-sym">-&gt;</span><span class="src-id">base_string&nbsp;</span>=&nbsp;<span class="src-var">$base_string</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a154"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a155"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Fetch&nbsp;the&nbsp;private&nbsp;key&nbsp;cert&nbsp;based&nbsp;on&nbsp;the&nbsp;request</span></div></li>
<li><div class="src-line"><a name="a156"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$cert&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthSignatureMethod_RSA_SHA1.html#methodfetch_private_cert">fetch_private_cert</a><span class="src-sym">(</span><span class="src-var">$request</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a157"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a158"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Pull&nbsp;the&nbsp;private&nbsp;key&nbsp;ID&nbsp;from&nbsp;the&nbsp;certificate</span></div></li>
<li><div class="src-line"><a name="a159"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$privatekeyid&nbsp;</span>=&nbsp;<a href="http://www.php.net/openssl_get_privatekey">openssl_get_privatekey</a><span class="src-sym">(</span><span class="src-var">$cert</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a160"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a161"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Sign&nbsp;using&nbsp;the&nbsp;key</span></div></li>
<li><div class="src-line"><a name="a162"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$ok&nbsp;</span>=&nbsp;<a href="http://www.php.net/openssl_sign">openssl_sign</a><span class="src-sym">(</span><span class="src-var">$base_string</span><span class="src-sym">,&nbsp;</span><span class="src-var">$signature</span><span class="src-sym">,&nbsp;</span><span class="src-var">$privatekeyid</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a163"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a164"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Release&nbsp;the&nbsp;key&nbsp;resource</span></div></li>
<li><div class="src-line"><a name="a165"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/openssl_free_key">openssl_free_key</a><span class="src-sym">(</span><span class="src-var">$privatekeyid</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a166"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a167"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/base64_encode">base64_encode</a><span class="src-sym">(</span><span class="src-var">$signature</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a168"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a169"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a170"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthSignatureMethod_RSA_SHA1.html#methodcheck_signature">check_signature</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$request</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">,&nbsp;</span><span class="src-var">$signature</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a171"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$decoded_sig&nbsp;</span>=&nbsp;<a href="http://www.php.net/base64_decode">base64_decode</a><span class="src-sym">(</span><span class="src-var">$signature</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a172"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a173"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$base_string&nbsp;</span>=&nbsp;<span class="src-var">$request</span><span class="src-sym">-&gt;</span><span class="src-id">get_signature_base_string</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a174"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a175"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Fetch&nbsp;the&nbsp;public&nbsp;key&nbsp;cert&nbsp;based&nbsp;on&nbsp;the&nbsp;request</span></div></li>
<li><div class="src-line"><a name="a176"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$cert&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthSignatureMethod_RSA_SHA1.html#methodfetch_public_cert">fetch_public_cert</a><span class="src-sym">(</span><span class="src-var">$request</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a177"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a178"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Pull&nbsp;the&nbsp;public&nbsp;key&nbsp;ID&nbsp;from&nbsp;the&nbsp;certificate</span></div></li>
<li><div class="src-line"><a name="a179"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$publickeyid&nbsp;</span>=&nbsp;<a href="http://www.php.net/openssl_get_publickey">openssl_get_publickey</a><span class="src-sym">(</span><span class="src-var">$cert</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a180"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a181"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Check&nbsp;the&nbsp;computed&nbsp;signature&nbsp;against&nbsp;the&nbsp;one&nbsp;passed&nbsp;in&nbsp;the&nbsp;query</span></div></li>
<li><div class="src-line"><a name="a182"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$ok&nbsp;</span>=&nbsp;<a href="http://www.php.net/openssl_verify">openssl_verify</a><span class="src-sym">(</span><span class="src-var">$base_string</span><span class="src-sym">,&nbsp;</span><span class="src-var">$decoded_sig</span><span class="src-sym">,&nbsp;</span><span class="src-var">$publickeyid</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a183"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a184"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Release&nbsp;the&nbsp;key&nbsp;resource</span></div></li>
<li><div class="src-line"><a name="a185"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/openssl_free_key">openssl_free_key</a><span class="src-sym">(</span><span class="src-var">$publickeyid</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a186"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a187"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$ok&nbsp;</span>==&nbsp;<span class="src-num">1</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a188"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a189"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a190"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a191"></a><span class="src-key">class&nbsp;</span><a href="../OAuth/OAuthRequest.html">OAuthRequest</a>&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a192"></a>&nbsp;&nbsp;<span class="src-key">var&nbsp;</span><a href="../OAuth/OAuthRequest.html#var$parameters">$parameters</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a193"></a>&nbsp;&nbsp;<span class="src-key">var&nbsp;</span><a href="../OAuth/OAuthRequest.html#var$http_method">$http_method</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a194"></a>&nbsp;&nbsp;<span class="src-key">var&nbsp;</span><a href="../OAuth/OAuthRequest.html#var$http_url">$http_url</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a195"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;for&nbsp;debug&nbsp;purposes</span></div></li>
<li><div class="src-line"><a name="a196"></a>&nbsp;&nbsp;<span class="src-key">var&nbsp;</span><a href="../OAuth/OAuthRequest.html#var$base_string">$base_string</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a197"></a>&nbsp;&nbsp;<span class="src-key">var&nbsp;</span><a href="../OAuth/OAuthRequest.html#var$version">$version</a>&nbsp;=&nbsp;<span class="src-str">'1.0'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a198"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a199"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodOAuthRequest">OAuthRequest</a><span class="src-sym">(</span><span class="src-var">$http_method</span><span class="src-sym">,&nbsp;</span><span class="src-var">$http_url</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parameters</span>=<span class="src-id">NULL</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a200"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">@</span><span class="src-var">$parameters&nbsp;</span><span class="src-key">or&nbsp;</span><span class="src-var">$parameters&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a201"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#var$parameters">parameters</a>&nbsp;=&nbsp;<span class="src-var">$parameters</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a202"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#var$http_method">http_method</a>&nbsp;=&nbsp;<span class="src-var">$http_method</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a203"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#var$http_url">http_url</a>&nbsp;=&nbsp;<span class="src-var">$http_url</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a204"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a205"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a206"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodunset_parameter">unset_parameter</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a207"></a>&nbsp;&nbsp;&nbsp;&nbsp;unset<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#var$parameters">parameters</a><span class="src-sym">[</span><span class="src-var">$name</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a208"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a209"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a210"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a211"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a212"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;attempt&nbsp;to&nbsp;build&nbsp;up&nbsp;a&nbsp;request&nbsp;from&nbsp;what&nbsp;was&nbsp;passed&nbsp;to&nbsp;the&nbsp;server</span></div></li>
<li><div class="src-line"><a name="a213"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a214"></a>&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodfrom_request">from_request</a><span class="src-sym">(</span><span class="src-var">$http_method</span>=<span class="src-id">NULL</span><span class="src-sym">,&nbsp;</span><span class="src-var">$http_url</span>=<span class="src-id">NULL</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parameters</span>=<span class="src-id">NULL</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a215"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$scheme&nbsp;</span>=&nbsp;<span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'HTTPS'</span><span class="src-sym">]</span><span class="src-sym">)&nbsp;</span>||&nbsp;<span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'HTTPS'</span><span class="src-sym">]&nbsp;</span>!=&nbsp;<span class="src-str">&quot;on&quot;</span><span class="src-sym">)&nbsp;</span>?&nbsp;<span class="src-str">'http'&nbsp;</span>:&nbsp;<span class="src-str">'https'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a216"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">@</span><span class="src-var">$http_url&nbsp;</span><span class="src-key">or&nbsp;</span><span class="src-var">$http_url&nbsp;</span>=&nbsp;<span class="src-var">$scheme&nbsp;</span>.&nbsp;<span class="src-str">'://'&nbsp;</span>.&nbsp;<span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'HTTP_HOST'</span><span class="src-sym">]&nbsp;</span>.&nbsp;<span class="src-str">':'&nbsp;</span>.&nbsp;<span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'SERVER_PORT'</span><span class="src-sym">]&nbsp;</span>.&nbsp;<span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'REQUEST_URI'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a217"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">@</span><span class="src-var">$http_method&nbsp;</span><span class="src-key">or&nbsp;</span><span class="src-var">$http_method&nbsp;</span>=&nbsp;<span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'REQUEST_METHOD'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a218"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a219"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$request_headers&nbsp;</span>=&nbsp;<a href="../OAuth/OAuthRequest.html#methodOAuthRequest">OAuthRequest</a><span class="src-sym">::</span><a href="../OAuth/OAuthRequest.html#methodget_headers">get_headers</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a220"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a221"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;let&nbsp;the&nbsp;library&nbsp;user&nbsp;override&nbsp;things&nbsp;however&nbsp;they'd&nbsp;like,&nbsp;if&nbsp;they&nbsp;know</span></div></li>
<li><div class="src-line"><a name="a222"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;which&nbsp;parameters&nbsp;to&nbsp;use&nbsp;then&nbsp;go&nbsp;for&nbsp;it,&nbsp;for&nbsp;example&nbsp;XMLRPC&nbsp;might&nbsp;want&nbsp;to</span></div></li>
<li><div class="src-line"><a name="a223"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;do&nbsp;this</span></div></li>
<li><div class="src-line"><a name="a224"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$parameters</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a225"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$req&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodOAuthRequest">OAuthRequest</a><span class="src-sym">(</span><span class="src-var">$http_method</span><span class="src-sym">,&nbsp;</span><span class="src-var">$http_url</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a226"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a227"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;collect&nbsp;request&nbsp;parameters&nbsp;from&nbsp;query&nbsp;string&nbsp;(GET)&nbsp;and&nbsp;post-data&nbsp;(POST)&nbsp;if&nbsp;appropriate&nbsp;(note:&nbsp;POST&nbsp;vars&nbsp;have&nbsp;priority)</span></div></li>
<li><div class="src-line"><a name="a228"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;NOTE:&nbsp;$_GET&nbsp;and&nbsp;$_POST&nbsp;will&nbsp;strip&nbsp;duplicate&nbsp;query&nbsp;parameters</span></div></li>
<li><div class="src-line"><a name="a229"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$req_parameters&nbsp;</span>=&nbsp;<span class="src-var">$_GET</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a230"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$http_method&nbsp;</span>==&nbsp;<span class="src-str">&quot;POST&quot;&nbsp;</span>&amp;&amp;&nbsp;<span class="src-sym">@</span><a href="http://www.php.net/strstr">strstr</a><span class="src-sym">(</span><span class="src-var">$request_headers</span><span class="src-sym">[</span><span class="src-str">&quot;Content-Type&quot;</span><span class="src-sym">]</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;application/x-www-form-urlencoded&quot;</span><span class="src-sym">)&nbsp;)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a231"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$req_parameters&nbsp;</span>=&nbsp;<a href="http://www.php.net/array_merge">array_merge</a><span class="src-sym">(</span><span class="src-var">$req_parameters</span><span class="src-sym">,&nbsp;</span><span class="src-var">$_POST</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a232"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a233"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a234"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;next&nbsp;check&nbsp;for&nbsp;the&nbsp;auth&nbsp;header,&nbsp;we&nbsp;need&nbsp;to&nbsp;do&nbsp;some&nbsp;extra&nbsp;stuff</span></div></li>
<li><div class="src-line"><a name="a235"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;if&nbsp;that&nbsp;is&nbsp;the&nbsp;case,&nbsp;namely&nbsp;suck&nbsp;in&nbsp;the&nbsp;parameters&nbsp;from&nbsp;GET&nbsp;or&nbsp;POST</span></div></li>
<li><div class="src-line"><a name="a236"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;so&nbsp;that&nbsp;we&nbsp;can&nbsp;include&nbsp;them&nbsp;in&nbsp;the&nbsp;signature</span></div></li>
<li><div class="src-line"><a name="a237"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">@</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$request_headers</span><span class="src-sym">[</span><span class="src-str">'Authorization'</span><span class="src-sym">]</span><span class="src-sym">,&nbsp;</span><span class="src-num">0</span><span class="src-sym">,&nbsp;</span><span class="src-num">6</span><span class="src-sym">)&nbsp;</span>==&nbsp;<span class="src-str">&quot;OAuth&nbsp;&quot;</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a238"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$header_parameters&nbsp;</span>=&nbsp;<a href="../OAuth/OAuthRequest.html#methodOAuthRequest">OAuthRequest</a><span class="src-sym">::</span><a href="../OAuth/OAuthRequest.html#methodsplit_header">split_header</a><span class="src-sym">(</span><span class="src-var">$request_headers</span><span class="src-sym">[</span><span class="src-str">'Authorization'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a239"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parameters&nbsp;</span>=&nbsp;<a href="http://www.php.net/array_merge">array_merge</a><span class="src-sym">(</span><span class="src-var">$req_parameters</span><span class="src-sym">,&nbsp;</span><span class="src-var">$header_parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a240"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$req&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodOAuthRequest">OAuthRequest</a><span class="src-sym">(</span><span class="src-var">$http_method</span><span class="src-sym">,&nbsp;</span><span class="src-var">$http_url</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a241"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-var">$req&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodOAuthRequest">OAuthRequest</a><span class="src-sym">(</span><span class="src-var">$http_method</span><span class="src-sym">,&nbsp;</span><span class="src-var">$http_url</span><span class="src-sym">,&nbsp;</span><span class="src-var">$req_parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a242"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a243"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a244"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$req</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a245"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a246"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a247"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a248"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;pretty&nbsp;much&nbsp;a&nbsp;helper&nbsp;function&nbsp;to&nbsp;set&nbsp;up&nbsp;the&nbsp;request</span></div></li>
<li><div class="src-line"><a name="a249"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a250"></a>&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodfrom_consumer_and_token">from_consumer_and_token</a><span class="src-sym">(</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">,&nbsp;</span><span class="src-var">$http_method</span><span class="src-sym">,&nbsp;</span><span class="src-var">$http_url</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parameters</span>=<span class="src-id">NULL</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a251"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">@</span><span class="src-var">$parameters&nbsp;</span><span class="src-key">or&nbsp;</span><span class="src-var">$parameters&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a252"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$defaults&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;oauth_version&quot;&nbsp;</span>=&gt;&nbsp;<span class="src-str">'1.0'</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a253"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">&quot;oauth_nonce&quot;&nbsp;</span>=&gt;&nbsp;<a href="../OAuth/OAuthRequest.html#methodOAuthRequest">OAuthRequest</a><span class="src-sym">::</span><a href="../OAuth/OAuthRequest.html#methodgenerate_nonce">generate_nonce</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a254"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">&quot;oauth_timestamp&quot;&nbsp;</span>=&gt;&nbsp;<a href="../OAuth/OAuthRequest.html#methodOAuthRequest">OAuthRequest</a><span class="src-sym">::</span><a href="../OAuth/OAuthRequest.html#methodgenerate_timestamp">generate_timestamp</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a255"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">&quot;oauth_consumer_key&quot;&nbsp;</span>=&gt;&nbsp;<span class="src-var">$consumer</span><span class="src-sym">-&gt;</span><span class="src-id">key</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a256"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parameters&nbsp;</span>=&nbsp;<a href="http://www.php.net/array_merge">array_merge</a><span class="src-sym">(</span><span class="src-var">$defaults</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a257"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a258"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$token</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a259"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'oauth_token'</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$token</span><span class="src-sym">-&gt;</span><span class="src-id">key</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a260"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a261"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-key">new&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodOAuthRequest">OAuthRequest</a><span class="src-sym">(</span><span class="src-var">$http_method</span><span class="src-sym">,&nbsp;</span><span class="src-var">$http_url</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a262"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a263"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a264"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodset_parameter">set_parameter</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">,&nbsp;</span><span class="src-var">$value</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a265"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#var$parameters">parameters</a><span class="src-sym">[</span><span class="src-var">$name</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$value</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a266"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a267"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a268"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodget_parameter">get_parameter</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a269"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span>isset<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#var$parameters">parameters</a><span class="src-sym">[</span><span class="src-var">$name</span><span class="src-sym">]</span><span class="src-sym">)&nbsp;</span>?&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#var$parameters">parameters</a><span class="src-sym">[</span><span class="src-var">$name</span><span class="src-sym">]&nbsp;</span>:&nbsp;<span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a270"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a271"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a272"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodget_parameters">get_parameters</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a273"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#var$parameters">parameters</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a274"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a275"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a276"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a277"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Returns&nbsp;the&nbsp;normalized&nbsp;parameters&nbsp;of&nbsp;the&nbsp;request</span></div></li>
<li><div class="src-line"><a name="a278"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a279"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;This&nbsp;will&nbsp;be&nbsp;all&nbsp;(except&nbsp;oauth_signature)&nbsp;parameters,</span></div></li>
<li><div class="src-line"><a name="a280"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;sorted&nbsp;first&nbsp;by&nbsp;key,&nbsp;and&nbsp;if&nbsp;duplicate&nbsp;keys,&nbsp;then&nbsp;by</span></div></li>
<li><div class="src-line"><a name="a281"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;value.</span></div></li>
<li><div class="src-line"><a name="a282"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a283"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;The&nbsp;returned&nbsp;string&nbsp;will&nbsp;be&nbsp;all&nbsp;the&nbsp;key=value&nbsp;pairs</span></div></li>
<li><div class="src-line"><a name="a284"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;concated&nbsp;by&nbsp;&amp;.</span></div></li>
<li><div class="src-line"><a name="a285"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a286"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">string&nbsp;</span></div></li>
<li><div class="src-line"><a name="a287"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a288"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodget_signable_parameters">get_signable_parameters</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a289"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Include&nbsp;query&nbsp;parameters</span></div></li>
<li><div class="src-line"><a name="a290"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$query_str&nbsp;</span>=&nbsp;<a href="http://www.php.net/parse_url">parse_url</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#var$http_url">http_url</a><span class="src-sym">,&nbsp;</span><span class="src-id">PHP_URL_QUERY</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a291"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$query_str</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a292"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parsed_query&nbsp;</span>=&nbsp;<span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodoauth_parse_string">oauth_parse_string</a><span class="src-sym">(</span><span class="src-var">$query_str</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a293"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/parse_str">parse_str</a><span class="src-sym">(</span><span class="src-var">$query_str</span><span class="src-sym">,&nbsp;</span><span class="src-var">$php_parsed_query</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a294"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a295"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodoauth_http_build_query">oauth_http_build_query</a><span class="src-sym">(</span><span class="src-var">$parsed_query</span><span class="src-sym">)&nbsp;</span>!=&nbsp;<span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodoauth_http_build_query">oauth_http_build_query</a><span class="src-sym">(</span><span class="src-var">$php_parsed_query</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a296"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parsed_query&nbsp;</span>=&nbsp;<span class="src-var">$php_parsed_query</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a297"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a298"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a299"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$parsed_query&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$key&nbsp;</span>=&gt;&nbsp;<span class="src-var">$value</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a300"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#methodset_parameter">set_parameter</a><span class="src-sym">(</span><span class="src-var">$key</span><span class="src-sym">,&nbsp;</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a301"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a302"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a303"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Grab&nbsp;all&nbsp;parameters</span></div></li>
<li><div class="src-line"><a name="a304"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$params&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#var$parameters">parameters</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a305"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a306"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Remove&nbsp;oauth_signature&nbsp;if&nbsp;present</span></div></li>
<li><div class="src-line"><a name="a307"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">[</span><span class="src-str">'oauth_signature'</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a308"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unset<span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">[</span><span class="src-str">'oauth_signature'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a309"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a310"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a311"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodoauth_http_build_query">oauth_http_build_query</a><span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a312"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a313"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a314"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a315"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Returns&nbsp;the&nbsp;base&nbsp;string&nbsp;of&nbsp;this&nbsp;request</span></div></li>
<li><div class="src-line"><a name="a316"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a317"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;The&nbsp;base&nbsp;string&nbsp;defined&nbsp;as&nbsp;the&nbsp;method,&nbsp;the&nbsp;url</span></div></li>
<li><div class="src-line"><a name="a318"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;and&nbsp;the&nbsp;parameters&nbsp;(normalized),&nbsp;each&nbsp;urlencoded</span></div></li>
<li><div class="src-line"><a name="a319"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;and&nbsp;the&nbsp;concated&nbsp;with&nbsp;&amp;.</span></div></li>
<li><div class="src-line"><a name="a320"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a321"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodget_signature_base_string">get_signature_base_string</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a322"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parts&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span></div></li>
<li><div class="src-line"><a name="a323"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#methodget_normalized_http_method">get_normalized_http_method</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a324"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#methodget_normalized_http_url">get_normalized_http_url</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a325"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#methodget_signable_parameters">get_signable_parameters</a><span class="src-sym">(</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a326"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a327"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a328"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parts&nbsp;</span>=&nbsp;<span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodurlencode_rfc3986">urlencode_rfc3986</a><span class="src-sym">(</span><span class="src-var">$parts</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a329"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a330"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/implode">implode</a><span class="src-sym">(</span><span class="src-str">'&amp;'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parts</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a331"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a332"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a333"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a334"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;just&nbsp;uppercases&nbsp;the&nbsp;http&nbsp;method</span></div></li>
<li><div class="src-line"><a name="a335"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a336"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodget_normalized_http_method">get_normalized_http_method</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a337"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#var$http_method">http_method</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a338"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a339"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a340"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a341"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;parses&nbsp;the&nbsp;url&nbsp;and&nbsp;rebuilds&nbsp;it&nbsp;to&nbsp;be</span></div></li>
<li><div class="src-line"><a name="a342"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;scheme://host/path</span></div></li>
<li><div class="src-line"><a name="a343"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a344"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodget_normalized_http_url">get_normalized_http_url</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a345"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parts&nbsp;</span>=&nbsp;<a href="http://www.php.net/parse_url">parse_url</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#var$http_url">http_url</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a346"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a347"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$port&nbsp;</span>=&nbsp;<span class="src-sym">@</span><span class="src-var">$parts</span><span class="src-sym">[</span><span class="src-str">'port'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a348"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$scheme&nbsp;</span>=&nbsp;<span class="src-var">$parts</span><span class="src-sym">[</span><span class="src-str">'scheme'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a349"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$host&nbsp;</span>=&nbsp;<span class="src-var">$parts</span><span class="src-sym">[</span><span class="src-str">'host'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a350"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$path&nbsp;</span>=&nbsp;<span class="src-sym">@</span><span class="src-var">$parts</span><span class="src-sym">[</span><span class="src-str">'path'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a351"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a352"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$port&nbsp;</span><span class="src-key">or&nbsp;</span><span class="src-var">$port&nbsp;</span>=&nbsp;<span class="src-sym">(</span><span class="src-var">$scheme&nbsp;</span>==&nbsp;<span class="src-str">'https'</span><span class="src-sym">)&nbsp;</span>?&nbsp;<span class="src-str">'443'&nbsp;</span>:&nbsp;<span class="src-str">'80'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a353"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a354"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">((</span><span class="src-var">$scheme&nbsp;</span>==&nbsp;<span class="src-str">'https'&nbsp;</span>&amp;&amp;&nbsp;<span class="src-var">$port&nbsp;</span>!=&nbsp;<span class="src-str">'443'</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a355"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;<span class="src-sym">(</span><span class="src-var">$scheme&nbsp;</span>==&nbsp;<span class="src-str">'http'&nbsp;</span>&amp;&amp;&nbsp;<span class="src-var">$port&nbsp;</span>!=&nbsp;<span class="src-str">'80'</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a356"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$host&nbsp;</span>=&nbsp;<span class="src-str">&quot;</span><span class="src-str"><span class="src-var">$host</span>:<span class="src-var">$port</span></span><span class="src-str">&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a357"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a358"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-str">&quot;</span><span class="src-str"><span class="src-var">$scheme</span>://<span class="src-var">$host$path</span></span><span class="src-str">&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a359"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a360"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a361"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a362"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;builds&nbsp;a&nbsp;url&nbsp;usable&nbsp;for&nbsp;a&nbsp;GET&nbsp;request</span></div></li>
<li><div class="src-line"><a name="a363"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a364"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodto_url">to_url</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a365"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$out&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#methodget_normalized_http_url">get_normalized_http_url</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span>.&nbsp;<span class="src-str">&quot;?&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a366"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$out&nbsp;</span>.=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#methodto_postdata">to_postdata</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a367"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$out</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a368"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a369"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a370"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a371"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;builds&nbsp;the&nbsp;data&nbsp;one&nbsp;would&nbsp;send&nbsp;in&nbsp;a&nbsp;POST&nbsp;request</span></div></li>
<li><div class="src-line"><a name="a372"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a373"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodto_postdata">to_postdata</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a374"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodoauth_http_build_query">oauth_http_build_query</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#var$parameters">parameters</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a375"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a376"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a377"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a378"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;builds&nbsp;the&nbsp;Authorization:&nbsp;header</span></div></li>
<li><div class="src-line"><a name="a379"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a380"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodto_header">to_header</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a381"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$out&nbsp;</span>=<span class="src-str">'Authorization:&nbsp;OAuth&nbsp;realm=&quot;yahooapis.com&quot;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a382"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$total&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a383"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#var$parameters">parameters</a>&nbsp;<span class="src-key">as&nbsp;</span><span class="src-var">$k&nbsp;</span>=&gt;&nbsp;<span class="src-var">$v</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a384"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$k</span><span class="src-sym">,&nbsp;</span><span class="src-num">0</span><span class="src-sym">,&nbsp;</span><span class="src-num">5</span><span class="src-sym">)&nbsp;</span>!=&nbsp;<span class="src-str">&quot;oauth&quot;</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a385"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a386"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">continue</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a387"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a388"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$v</span><span class="src-sym">))</span></div></li>
<li><div class="src-line"><a name="a389"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a390"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/trigger_error">trigger_error</a><span class="src-sym">(</span><span class="src-str">'Arrays&nbsp;not&nbsp;supported&nbsp;in&nbsp;headers'</span><span class="src-sym">,&nbsp;</span><span class="src-id">E_USER_WARNING</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a391"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a392"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a393"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$out&nbsp;</span>.=&nbsp;<span class="src-str">','&nbsp;</span>.&nbsp;<span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodurlencode_rfc3986">urlencode_rfc3986</a><span class="src-sym">(</span><span class="src-var">$k</span><span class="src-sym">)&nbsp;</span>.&nbsp;<span class="src-str">'=&quot;'&nbsp;</span>.&nbsp;<span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodurlencode_rfc3986">urlencode_rfc3986</a><span class="src-sym">(</span><span class="src-var">$v</span><span class="src-sym">)&nbsp;</span>.&nbsp;<span class="src-str">'&quot;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a394"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a395"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a396"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$out</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a397"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a398"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a399"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#method__toString">__toString</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a400"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#methodto_url">to_url</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a401"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a402"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a403"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a404"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodsign_request">sign_request</a><span class="src-sym">(</span><span class="src-var">$signature_method</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a405"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#methodset_parameter">set_parameter</a><span class="src-sym">(</span><span class="src-str">&quot;oauth_signature_method&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$signature_method</span><span class="src-sym">-&gt;</span><span class="src-id">get_name</span><span class="src-sym">(</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a406"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$signature&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#methodbuild_signature">build_signature</a><span class="src-sym">(</span><span class="src-var">$signature_method</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a407"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthRequest.html#methodset_parameter">set_parameter</a><span class="src-sym">(</span><span class="src-str">&quot;oauth_signature&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$signature</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a408"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a409"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a410"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodbuild_signature">build_signature</a><span class="src-sym">(</span><span class="src-var">$signature_method</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a411"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$signature&nbsp;</span>=&nbsp;<span class="src-var">$signature_method</span><span class="src-sym">-&gt;</span><span class="src-id">build_signature</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a412"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$signature</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a413"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a414"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a415"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a416"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;util&nbsp;function:&nbsp;current&nbsp;timestamp</span></div></li>
<li><div class="src-line"><a name="a417"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a418"></a>&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodgenerate_timestamp">generate_timestamp</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a419"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/time">time</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a420"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a421"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a422"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a423"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;util&nbsp;function:&nbsp;current&nbsp;nonce</span></div></li>
<li><div class="src-line"><a name="a424"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a425"></a>&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodgenerate_nonce">generate_nonce</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a426"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$mt&nbsp;</span>=&nbsp;<a href="http://www.php.net/microtime">microtime</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a427"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$rand&nbsp;</span>=&nbsp;<a href="http://www.php.net/mt_rand">mt_rand</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a428"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a429"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/md5">md5</a><span class="src-sym">(</span><span class="src-var">$mt&nbsp;</span>.&nbsp;<span class="src-var">$rand</span><span class="src-sym">)</span><span class="src-sym">;&nbsp;</span><span class="src-comm">//&nbsp;md5s&nbsp;look&nbsp;nicer&nbsp;than&nbsp;numbers</span></div></li>
<li><div class="src-line"><a name="a430"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a431"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a432"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a433"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;util&nbsp;function&nbsp;for&nbsp;turning&nbsp;the&nbsp;Authorization:&nbsp;header&nbsp;into</span></div></li>
<li><div class="src-line"><a name="a434"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;parameters,&nbsp;has&nbsp;to&nbsp;do&nbsp;some&nbsp;unescaping</span></div></li>
<li><div class="src-line"><a name="a435"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a436"></a>&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodsplit_header">split_header</a><span class="src-sym">(</span><span class="src-var">$header</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a437"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$pattern&nbsp;</span>=&nbsp;<span class="src-str">'/(([-_a-z]*)=(&quot;([^&quot;]*)&quot;|([^,]*)),?)/'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a438"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$offset&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a439"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$params&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a440"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">while&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/preg_match">preg_match</a><span class="src-sym">(</span><span class="src-var">$pattern</span><span class="src-sym">,&nbsp;</span><span class="src-var">$header</span><span class="src-sym">,&nbsp;</span><span class="src-var">$matches</span><span class="src-sym">,&nbsp;</span><span class="src-id">PREG_OFFSET_CAPTURE</span><span class="src-sym">,&nbsp;</span><span class="src-var">$offset</span><span class="src-sym">)&nbsp;</span>&gt;&nbsp;<span class="src-num">0</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a441"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$match&nbsp;</span>=&nbsp;<span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a442"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$header_name&nbsp;</span>=&nbsp;<span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-num">2</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a443"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$header_content&nbsp;</span>=&nbsp;<span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-num">5</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span>?&nbsp;<span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-num">5</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]&nbsp;</span>:&nbsp;<span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-num">4</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a444"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$params</span><span class="src-sym">[</span><span class="src-var">$header_name</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodurldecode_rfc3986">urldecode_rfc3986</a><span class="src-sym">(&nbsp;</span><span class="src-var">$header_content&nbsp;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a445"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$offset&nbsp;</span>=&nbsp;<span class="src-var">$match</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]&nbsp;</span>+&nbsp;<a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$match</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a446"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a447"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a448"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">[</span><span class="src-str">'realm'</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a449"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unset<span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">[</span><span class="src-str">'realm'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a450"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a451"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a452"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$params</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a453"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a454"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a455"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a456"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;helper&nbsp;to&nbsp;try&nbsp;to&nbsp;sort&nbsp;out&nbsp;headers&nbsp;for&nbsp;people&nbsp;who&nbsp;aren't&nbsp;running&nbsp;apache</span></div></li>
<li><div class="src-line"><a name="a457"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a458"></a>&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthRequest.html#methodget_headers">get_headers</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a459"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/function_exists">function_exists</a><span class="src-sym">(</span><span class="src-str">'apache_request_headers'</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a460"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;we&nbsp;need&nbsp;this&nbsp;to&nbsp;get&nbsp;the&nbsp;actual&nbsp;Authorization:&nbsp;header</span></div></li>
<li><div class="src-line"><a name="a461"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;because&nbsp;apache&nbsp;tends&nbsp;to&nbsp;tell&nbsp;us&nbsp;it&nbsp;doesn't&nbsp;exist</span></div></li>
<li><div class="src-line"><a name="a462"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">apache_request_headers</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a463"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a464"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;otherwise&nbsp;we&nbsp;don't&nbsp;have&nbsp;apache&nbsp;and&nbsp;are&nbsp;just&nbsp;going&nbsp;to&nbsp;have&nbsp;to&nbsp;hope</span></div></li>
<li><div class="src-line"><a name="a465"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;that&nbsp;$_SERVER&nbsp;actually&nbsp;contains&nbsp;what&nbsp;we&nbsp;need</span></div></li>
<li><div class="src-line"><a name="a466"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$out&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a467"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$_SERVER&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$key&nbsp;</span>=&gt;&nbsp;<span class="src-var">$value</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a468"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$key</span><span class="src-sym">,&nbsp;</span><span class="src-num">0</span><span class="src-sym">,&nbsp;</span><span class="src-num">5</span><span class="src-sym">)&nbsp;</span>==&nbsp;<span class="src-str">&quot;HTTP_&quot;</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a469"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;this&nbsp;is&nbsp;chaos,&nbsp;basically&nbsp;it&nbsp;is&nbsp;just&nbsp;there&nbsp;to&nbsp;capitalize&nbsp;the&nbsp;first</span></div></li>
<li><div class="src-line"><a name="a470"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;letter&nbsp;of&nbsp;every&nbsp;word&nbsp;that&nbsp;is&nbsp;not&nbsp;an&nbsp;initial&nbsp;HTTP&nbsp;and&nbsp;strip&nbsp;HTTP</span></div></li>
<li><div class="src-line"><a name="a471"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;code&nbsp;from&nbsp;przemek</span></div></li>
<li><div class="src-line"><a name="a472"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$key&nbsp;</span>=&nbsp;<a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">&quot;&nbsp;&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;-&quot;</span><span class="src-sym">,&nbsp;</span><a href="http://www.php.net/ucwords">ucwords</a><span class="src-sym">(</span><a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">&quot;_&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;&nbsp;&quot;</span><span class="src-sym">,&nbsp;</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$key</span><span class="src-sym">,&nbsp;</span><span class="src-num">5</span><span class="src-sym">)))))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a473"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$out</span><span class="src-sym">[</span><span class="src-var">$key</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$value</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a474"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a475"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a476"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a477"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$out</span><span class="src-sym">[</span><span class="src-str">'Content-Type'</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a478"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$out</span><span class="src-sym">[</span><span class="src-str">'Content-Type'</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-sym">@</span><span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'CONTENT_TYPE'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a479"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a480"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a481"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$out</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a482"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a483"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a484"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a485"></a><span class="src-key">class&nbsp;</span><a href="../OAuth/OAuthServer.html">OAuthServer</a>&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a486"></a>&nbsp;&nbsp;<span class="src-key">var&nbsp;</span><a href="../OAuth/OAuthServer.html#var$timestamp_threshold">$timestamp_threshold</a>&nbsp;=&nbsp;<span class="src-num">300</span><span class="src-sym">;&nbsp;</span><span class="src-comm">//&nbsp;in&nbsp;seconds,&nbsp;five&nbsp;minutes</span></div></li>
<li><div class="src-line"><a name="a487"></a>&nbsp;&nbsp;<span class="src-key">var&nbsp;</span><a href="../OAuth/OAuthServer.html#var$version">$version</a>&nbsp;=&nbsp;<span class="src-str">'1.0'</span><span class="src-sym">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-comm">//&nbsp;hi&nbsp;blaine</span></div></li>
<li><div class="src-line"><a name="a488"></a>&nbsp;&nbsp;<span class="src-key">var&nbsp;</span><a href="../OAuth/OAuthServer.html#var$signature_methods">$signature_methods</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a489"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a490"></a>&nbsp;&nbsp;<span class="src-key">var&nbsp;</span><a href="../OAuth/OAuthServer.html#var$data_store">$data_store</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a491"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a492"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthServer.html#methodOAuthServer">OAuthServer</a><span class="src-sym">(</span><span class="src-var">$data_store</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a493"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#var$data_store">data_store</a>&nbsp;=&nbsp;<span class="src-var">$data_store</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a494"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a495"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a496"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthServer.html#methodadd_signature_method">add_signature_method</a><span class="src-sym">(</span><span class="src-var">$signature_method</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a497"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#var$signature_methods">signature_methods</a><span class="src-sym">[</span><span class="src-var">$signature_method</span><span class="src-sym">-&gt;</span><span class="src-id">get_name</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">]&nbsp;</span>=</div></li>
<li><div class="src-line"><a name="a498"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$signature_method</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a499"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a500"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a501"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;high&nbsp;level&nbsp;functions</span></div></li>
<li><div class="src-line"><a name="a502"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a503"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a504"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;process&nbsp;a&nbsp;request_token&nbsp;request</span></div></li>
<li><div class="src-line"><a name="a505"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;returns&nbsp;the&nbsp;request&nbsp;token&nbsp;on&nbsp;success</span></div></li>
<li><div class="src-line"><a name="a506"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a507"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthServer.html#methodfetch_request_token">fetch_request_token</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$request</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a508"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#methodget_version">get_version</a><span class="src-sym">(</span><span class="src-var">$request</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a509"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a510"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$consumer&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#methodget_consumer">get_consumer</a><span class="src-sym">(</span><span class="src-var">$request</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a511"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a512"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;no&nbsp;token&nbsp;required&nbsp;for&nbsp;the&nbsp;initial&nbsp;token&nbsp;request</span></div></li>
<li><div class="src-line"><a name="a513"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$token&nbsp;</span>=&nbsp;<span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a514"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a515"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#methodcheck_signature">check_signature</a><span class="src-sym">(</span><span class="src-var">$request</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a516"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a517"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$new_token&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#var$data_store">data_store</a><span class="src-sym">-&gt;</span><span class="src-id">new_request_token</span><span class="src-sym">(</span><span class="src-var">$consumer</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a518"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a519"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$new_token</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a520"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a521"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a522"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a523"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;process&nbsp;an&nbsp;access_token&nbsp;request</span></div></li>
<li><div class="src-line"><a name="a524"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;returns&nbsp;the&nbsp;access&nbsp;token&nbsp;on&nbsp;success</span></div></li>
<li><div class="src-line"><a name="a525"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a526"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthServer.html#methodfetch_access_token">fetch_access_token</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$request</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a527"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#methodget_version">get_version</a><span class="src-sym">(</span><span class="src-var">$request</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a528"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a529"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$consumer&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#methodget_consumer">get_consumer</a><span class="src-sym">(</span><span class="src-var">$request</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a530"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a531"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;requires&nbsp;authorized&nbsp;request&nbsp;token</span></div></li>
<li><div class="src-line"><a name="a532"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$token&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#methodget_token">get_token</a><span class="src-sym">(</span><span class="src-var">$request</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;request&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a533"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a534"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a535"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#methodcheck_signature">check_signature</a><span class="src-sym">(</span><span class="src-var">$request</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a536"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a537"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$new_token&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#var$data_store">data_store</a><span class="src-sym">-&gt;</span><span class="src-id">new_access_token</span><span class="src-sym">(</span><span class="src-var">$token</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a538"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a539"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$new_token</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a540"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a541"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a542"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a543"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;verify&nbsp;an&nbsp;api&nbsp;call,&nbsp;checks&nbsp;all&nbsp;the&nbsp;parameters</span></div></li>
<li><div class="src-line"><a name="a544"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a545"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthServer.html#methodverify_request">verify_request</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$request</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a546"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#methodget_version">get_version</a><span class="src-sym">(</span><span class="src-var">$request</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a547"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$consumer&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#methodget_consumer">get_consumer</a><span class="src-sym">(</span><span class="src-var">$request</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a548"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$token&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#methodget_token">get_token</a><span class="src-sym">(</span><span class="src-var">$request</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;access&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a549"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#methodcheck_signature">check_signature</a><span class="src-sym">(</span><span class="src-var">$request</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a550"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a551"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a552"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a553"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;Internals&nbsp;from&nbsp;here</span></div></li>
<li><div class="src-line"><a name="a554"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a555"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;version&nbsp;1</span></div></li>
<li><div class="src-line"><a name="a556"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a557"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthServer.html#methodget_version">get_version</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$request</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a558"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$version&nbsp;</span>=&nbsp;<span class="src-var">$request</span><span class="src-sym">-&gt;</span><span class="src-id">get_parameter</span><span class="src-sym">(</span><span class="src-str">&quot;oauth_version&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a559"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$version</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a560"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$version&nbsp;</span>=&nbsp;<span class="src-str">'1.0'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a561"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a562"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$version&nbsp;</span>&amp;&amp;&nbsp;<span class="src-var">$version&nbsp;</span>!=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#var$version">version</a><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a563"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/trigger_error">trigger_error</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str">OAuth&nbsp;version&nbsp;'<span class="src-var">$version</span>'&nbsp;not&nbsp;supported</span><span class="src-str">&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-id">E_USER_WARNING</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a564"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-str">'1.0'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a565"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a566"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$version</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a567"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a568"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a569"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a570"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;figure&nbsp;out&nbsp;the&nbsp;signature&nbsp;with&nbsp;some&nbsp;defaults</span></div></li>
<li><div class="src-line"><a name="a571"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a572"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthServer.html#methodget_signature_method">get_signature_method</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$request</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a573"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$signature_method&nbsp;</span>=</div></li>
<li><div class="src-line"><a name="a574"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">@</span><span class="src-var">$request</span><span class="src-sym">-&gt;</span><span class="src-id">get_parameter</span><span class="src-sym">(</span><span class="src-str">&quot;oauth_signature_method&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a575"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$signature_method</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a576"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$signature_method&nbsp;</span>=&nbsp;<span class="src-str">&quot;PLAINTEXT&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a577"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a578"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$signature_method</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a579"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/array_keys">array_keys</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#var$signature_methods">signature_methods</a><span class="src-sym">)))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a580"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/trigger_error">trigger_error</a><span class="src-sym">(</span></div></li>
<li><div class="src-line"><a name="a581"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">&quot;</span><span class="src-str">Signature&nbsp;method&nbsp;'<span class="src-var">$signature_method</span>'&nbsp;not&nbsp;supported&nbsp;try&nbsp;one&nbsp;of&nbsp;the&nbsp;following:&nbsp;</span><span class="src-str">&quot;&nbsp;</span>.&nbsp;<a href="http://www.php.net/implode">implode</a><span class="src-sym">(</span><span class="src-str">&quot;,&nbsp;&quot;</span><span class="src-sym">,&nbsp;</span><a href="http://www.php.net/array_keys">array_keys</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#var$signature_methods">signature_methods</a><span class="src-sym">))</span><span class="src-sym">,&nbsp;</span><span class="src-id">E_USER_WARNING</span></div></li>
<li><div class="src-line"><a name="a582"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span><span class="src-sym">;&nbsp;</span><span class="src-key">return&nbsp;</span><span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a583"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a584"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#var$signature_methods">signature_methods</a><span class="src-sym">[</span><span class="src-var">$signature_method</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a585"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a586"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a587"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a588"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;try&nbsp;to&nbsp;find&nbsp;the&nbsp;consumer&nbsp;for&nbsp;the&nbsp;provided&nbsp;request's&nbsp;consumer&nbsp;key</span></div></li>
<li><div class="src-line"><a name="a589"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a590"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthServer.html#methodget_consumer">get_consumer</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$request</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a591"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$consumer_key&nbsp;</span>=&nbsp;<span class="src-sym">@</span><span class="src-var">$request</span><span class="src-sym">-&gt;</span><span class="src-id">get_parameter</span><span class="src-sym">(</span><span class="src-str">&quot;oauth_consumer_key&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a592"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$consumer_key</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a593"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/trigger_error">trigger_error</a><span class="src-sym">(</span><span class="src-str">&quot;Invalid&nbsp;consumer&nbsp;key&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-id">E_USER_WARNING</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a594"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a595"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a596"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a597"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$consumer&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#var$data_store">data_store</a><span class="src-sym">-&gt;</span><span class="src-id">lookup_consumer</span><span class="src-sym">(</span><span class="src-var">$consumer_key</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a598"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$consumer</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a599"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/trigger_error">trigger_error</a><span class="src-sym">(</span><span class="src-str">&quot;Invalid&nbsp;consumer&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-id">E_USER_WARNING</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a600"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a601"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a602"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a603"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a604"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a605"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a606"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a607"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;try&nbsp;to&nbsp;find&nbsp;the&nbsp;token&nbsp;for&nbsp;the&nbsp;provided&nbsp;request's&nbsp;token&nbsp;key</span></div></li>
<li><div class="src-line"><a name="a608"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a609"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthServer.html#methodget_token">get_token</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$request</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token_type</span>=<span class="src-str">&quot;access&quot;</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a610"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$token_field&nbsp;</span>=&nbsp;<span class="src-sym">@</span><span class="src-var">$request</span><span class="src-sym">-&gt;</span><span class="src-id">get_parameter</span><span class="src-sym">(</span><span class="src-str">'oauth_token'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a611"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$token&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#var$data_store">data_store</a><span class="src-sym">-&gt;</span><span class="src-id">lookup_token</span><span class="src-sym">(</span></div></li>
<li><div class="src-line"><a name="a612"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token_type</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token_field</span></div></li>
<li><div class="src-line"><a name="a613"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a614"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$token</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a615"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/trigger_error">trigger_error</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str">Invalid&nbsp;<span class="src-var">$token_type</span>&nbsp;token:&nbsp;<span class="src-var">$token_field</span></span><span class="src-str">&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-id">E_USER_WARNING</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a616"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a617"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a618"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$token</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a619"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a620"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a621"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a622"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;all-in-one&nbsp;function&nbsp;to&nbsp;check&nbsp;the&nbsp;signature&nbsp;on&nbsp;a&nbsp;request</span></div></li>
<li><div class="src-line"><a name="a623"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;should&nbsp;guess&nbsp;the&nbsp;signature&nbsp;method&nbsp;appropriately</span></div></li>
<li><div class="src-line"><a name="a624"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a625"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthServer.html#methodcheck_signature">check_signature</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$request</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a626"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;this&nbsp;should&nbsp;probably&nbsp;be&nbsp;in&nbsp;a&nbsp;different&nbsp;method</span></div></li>
<li><div class="src-line"><a name="a627"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$timestamp&nbsp;</span>=&nbsp;<span class="src-sym">@</span><span class="src-var">$request</span><span class="src-sym">-&gt;</span><span class="src-id">get_parameter</span><span class="src-sym">(</span><span class="src-str">'oauth_timestamp'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a628"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$nonce&nbsp;</span>=&nbsp;<span class="src-sym">@</span><span class="src-var">$request</span><span class="src-sym">-&gt;</span><span class="src-id">get_parameter</span><span class="src-sym">(</span><span class="src-str">'oauth_nonce'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a629"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a630"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#methodcheck_timestamp">check_timestamp</a><span class="src-sym">(</span><span class="src-var">$timestamp</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a631"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#methodcheck_nonce">check_nonce</a><span class="src-sym">(</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">,&nbsp;</span><span class="src-var">$nonce</span><span class="src-sym">,&nbsp;</span><span class="src-var">$timestamp</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a632"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a633"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$signature_method&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#methodget_signature_method">get_signature_method</a><span class="src-sym">(</span><span class="src-var">$request</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a634"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a635"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$signature&nbsp;</span>=&nbsp;<span class="src-var">$request</span><span class="src-sym">-&gt;</span><span class="src-id">get_parameter</span><span class="src-sym">(</span><span class="src-str">'oauth_signature'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a636"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$valid_sig&nbsp;</span>=&nbsp;<span class="src-var">$signature_method</span><span class="src-sym">-&gt;</span><span class="src-id">check_signature</span><span class="src-sym">(</span></div></li>
<li><div class="src-line"><a name="a637"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$request</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a638"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$consumer</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a639"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$token</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a640"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$signature</span></div></li>
<li><div class="src-line"><a name="a641"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a642"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a643"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$valid_sig</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a644"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/trigger_error">trigger_error</a><span class="src-sym">(</span><span class="src-str">&quot;Invalid&nbsp;signature&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-id">E_USER_WARNING</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a645"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a646"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a647"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a648"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a649"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a650"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;check&nbsp;that&nbsp;the&nbsp;timestamp&nbsp;is&nbsp;new&nbsp;enough</span></div></li>
<li><div class="src-line"><a name="a651"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a652"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthServer.html#methodcheck_timestamp">check_timestamp</a><span class="src-sym">(</span><span class="src-var">$timestamp</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a653"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;verify&nbsp;that&nbsp;timestamp&nbsp;is&nbsp;recentish</span></div></li>
<li><div class="src-line"><a name="a654"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$now&nbsp;</span>=&nbsp;<a href="http://www.php.net/time">time</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a655"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$now&nbsp;</span>-&nbsp;<span class="src-var">$timestamp&nbsp;</span>&gt;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#var$timestamp_threshold">timestamp_threshold</a><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a656"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/trigger_error">trigger_error</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str">Expired&nbsp;timestamp,&nbsp;yours&nbsp;<span class="src-var">$timestamp</span>,&nbsp;ours&nbsp;<span class="src-var">$now</span></span><span class="src-str">&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-id">E_USER_WARNING</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a657"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a658"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a659"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a660"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a661"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a662"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;check&nbsp;that&nbsp;the&nbsp;nonce&nbsp;is&nbsp;not&nbsp;repeated</span></div></li>
<li><div class="src-line"><a name="a663"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a664"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthServer.html#methodcheck_nonce">check_nonce</a><span class="src-sym">(</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">,&nbsp;</span><span class="src-var">$nonce</span><span class="src-sym">,&nbsp;</span><span class="src-var">$timestamp</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a665"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;verify&nbsp;that&nbsp;the&nbsp;nonce&nbsp;is&nbsp;uniqueish</span></div></li>
<li><div class="src-line"><a name="a666"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/OAuthServer.html#var$data_store">data_store</a><span class="src-sym">-&gt;</span><span class="src-id">lookup_nonce</span><span class="src-sym">(</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">,&nbsp;</span><span class="src-var">$nonce</span><span class="src-sym">,&nbsp;</span><span class="src-var">$timestamp</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a667"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a668"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/trigger_error">trigger_error</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str">Nonce&nbsp;already&nbsp;used:&nbsp;<span class="src-var">$nonce</span></span><span class="src-str">&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-id">E_USER_WARNING</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a669"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a670"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a671"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a672"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a673"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a674"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a675"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a676"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a677"></a><span class="src-key">class&nbsp;</span><a href="../OAuth/OAuthDataStore.html">OAuthDataStore</a>&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a678"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthDataStore.html#methodlookup_consumer">lookup_consumer</a><span class="src-sym">(</span><span class="src-var">$consumer_key</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a679"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;implement&nbsp;me</span></div></li>
<li><div class="src-line"><a name="a680"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a681"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a682"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthDataStore.html#methodlookup_token">lookup_token</a><span class="src-sym">(</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token_type</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a683"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;implement&nbsp;me</span></div></li>
<li><div class="src-line"><a name="a684"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a685"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a686"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthDataStore.html#methodlookup_nonce">lookup_nonce</a><span class="src-sym">(</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">,&nbsp;</span><span class="src-var">$nonce</span><span class="src-sym">,&nbsp;</span><span class="src-var">$timestamp</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a687"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;implement&nbsp;me</span></div></li>
<li><div class="src-line"><a name="a688"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a689"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a690"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthDataStore.html#methodnew_request_token">new_request_token</a><span class="src-sym">(</span><span class="src-var">$consumer</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a691"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;return&nbsp;a&nbsp;new&nbsp;token&nbsp;attached&nbsp;to&nbsp;this&nbsp;consumer</span></div></li>
<li><div class="src-line"><a name="a692"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a693"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a694"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthDataStore.html#methodnew_access_token">new_access_token</a><span class="src-sym">(</span><span class="src-var">$token</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a695"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;return&nbsp;a&nbsp;new&nbsp;access&nbsp;token&nbsp;attached&nbsp;to&nbsp;this&nbsp;consumer</span></div></li>
<li><div class="src-line"><a name="a696"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;for&nbsp;the&nbsp;user&nbsp;associated&nbsp;with&nbsp;this&nbsp;token&nbsp;if&nbsp;the&nbsp;request&nbsp;token</span></div></li>
<li><div class="src-line"><a name="a697"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;is&nbsp;authorized</span></div></li>
<li><div class="src-line"><a name="a698"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;should&nbsp;also&nbsp;invalidate&nbsp;the&nbsp;request&nbsp;token</span></div></li>
<li><div class="src-line"><a name="a699"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a700"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a701"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a702"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a703"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a704"></a><span class="src-comm">/*&nbsp;&nbsp;A&nbsp;very&nbsp;naive&nbsp;dbm-based&nbsp;oauth&nbsp;storage</span></div></li>
<li><div class="src-line"><a name="a705"></a><span class="src-comm">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a706"></a><span class="src-key">class&nbsp;</span><a href="../OAuth/SimpleOAuthDataStore.html">SimpleOAuthDataStore</a>&nbsp;<span class="src-key">extends&nbsp;</span><a href="../OAuth/OAuthDataStore.html">OAuthDataStore</a>&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a707"></a>&nbsp;&nbsp;<span class="src-key">var&nbsp;</span><a href="../OAuth/SimpleOAuthDataStore.html#var$dbh">$dbh</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a708"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a709"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/SimpleOAuthDataStore.html#methodSimpleOAuthDataStore">SimpleOAuthDataStore</a><span class="src-sym">(</span><span class="src-var">$path&nbsp;</span>=&nbsp;<span class="src-str">&quot;oauth.gdbm&quot;</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a710"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/SimpleOAuthDataStore.html#var$dbh">dbh</a>&nbsp;=&nbsp;<a href="http://www.php.net/dba_popen">dba_popen</a><span class="src-sym">(</span><span class="src-var">$path</span><span class="src-sym">,&nbsp;</span><span class="src-str">'c'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'gdbm'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a711"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a712"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a713"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/SimpleOAuthDataStore.html#method__destruct">__destruct</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a714"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/dba_close">dba_close</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/SimpleOAuthDataStore.html#var$dbh">dbh</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a715"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a716"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a717"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/SimpleOAuthDataStore.html#methodlookup_consumer">lookup_consumer</a><span class="src-sym">(</span><span class="src-var">$consumer_key</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a718"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$rv&nbsp;</span>=&nbsp;<a href="http://www.php.net/dba_fetch">dba_fetch</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str">consumer_<span class="src-var">$consumer_key</span></span><span class="src-str">&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/SimpleOAuthDataStore.html#var$dbh">dbh</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a719"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$rv&nbsp;</span>===&nbsp;<span class="src-id">FALSE</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a720"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a721"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a722"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$obj&nbsp;</span>=&nbsp;<a href="http://www.php.net/unserialize">unserialize</a><span class="src-sym">(</span><span class="src-var">$rv</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a723"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-sym">(</span><span class="src-var">$obj&nbsp;</span>instanceof&nbsp;<span class="src-id"><a href="../OAuth/OAuthConsumer.html">OAuthConsumer</a></span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a724"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a725"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a726"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$obj</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a727"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a728"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a729"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/SimpleOAuthDataStore.html#methodlookup_token">lookup_token</a><span class="src-sym">(</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token_type</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a730"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$rv&nbsp;</span>=&nbsp;<a href="http://www.php.net/dba_fetch">dba_fetch</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str">${<span class="src-str">token_type</span><span class="src-sym">}</span>_${<span class="src-str">token</span><span class="src-sym">}</span></span><span class="src-str">&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/SimpleOAuthDataStore.html#var$dbh">dbh</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a731"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$rv&nbsp;</span>===&nbsp;<span class="src-id">FALSE</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a732"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a733"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a734"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$obj&nbsp;</span>=&nbsp;<a href="http://www.php.net/unserialize">unserialize</a><span class="src-sym">(</span><span class="src-var">$rv</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a735"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-sym">(</span><span class="src-var">$obj&nbsp;</span>instanceof&nbsp;<span class="src-id"><a href="../OAuth/OAuthToken.html">OAuthToken</a></span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a736"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a737"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a738"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$obj</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a739"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a740"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a741"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/SimpleOAuthDataStore.html#methodlookup_nonce">lookup_nonce</a><span class="src-sym">(</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$token</span><span class="src-sym">,&nbsp;</span><span class="src-var">$nonce</span><span class="src-sym">,&nbsp;</span><span class="src-var">$timestamp</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a742"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/dba_exists">dba_exists</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str">nonce_<span class="src-var">$nonce</span></span><span class="src-str">&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/SimpleOAuthDataStore.html#var$dbh">dbh</a><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a743"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">TRUE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a744"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a745"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/dba_insert">dba_insert</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str">nonce_<span class="src-var">$nonce</span></span><span class="src-str">&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;1&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/SimpleOAuthDataStore.html#var$dbh">dbh</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a746"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a747"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a748"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a749"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a750"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/SimpleOAuthDataStore.html#methodnew_token">new_token</a><span class="src-sym">(</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$type</span>=<span class="src-str">&quot;request&quot;</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a751"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$key&nbsp;</span>=&nbsp;<a href="http://www.php.net/md5">md5</a><span class="src-sym">(</span><a href="http://www.php.net/time">time</a><span class="src-sym">(</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a752"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$secret&nbsp;</span>=&nbsp;<a href="http://www.php.net/mt_rand">mt_rand</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a753"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$token&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../OAuth/OAuthToken.html">OAuthToken</a></span><span class="src-sym">(</span><span class="src-var">$key</span><span class="src-sym">,&nbsp;</span><a href="http://www.php.net/md5">md5</a><span class="src-sym">(</span><span class="src-var">$secret</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a754"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/dba_insert">dba_insert</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str">${<span class="src-str">type</span><span class="src-sym">}</span>_<span class="src-var">$key</span></span><span class="src-str">&quot;</span><span class="src-sym">,&nbsp;</span><a href="http://www.php.net/serialize">serialize</a><span class="src-sym">(</span><span class="src-var">$token</span><span class="src-sym">)</span><span class="src-sym">,&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/SimpleOAuthDataStore.html#var$dbh">dbh</a><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a755"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/trigger_error">trigger_error</a><span class="src-sym">(</span><span class="src-str">&quot;doooom!&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-id">E_USER_WARNING</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a756"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a757"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a758"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$token</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a759"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a760"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a761"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/SimpleOAuthDataStore.html#methodnew_request_token">new_request_token</a><span class="src-sym">(</span><span class="src-var">$consumer</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a762"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/SimpleOAuthDataStore.html#methodnew_token">new_token</a><span class="src-sym">(</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;request&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a763"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a764"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a765"></a>&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/SimpleOAuthDataStore.html#methodnew_access_token">new_access_token</a><span class="src-sym">(</span><span class="src-var">$token</span><span class="src-sym">,&nbsp;</span><span class="src-var">$consumer</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a766"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a767"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$token&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/SimpleOAuthDataStore.html#methodnew_token">new_token</a><span class="src-sym">(</span><span class="src-var">$consumer</span><span class="src-sym">,&nbsp;</span><span class="src-str">'access'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a768"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/dba_delete">dba_delete</a><span class="src-sym">(</span><span class="src-str">&quot;request_&quot;&nbsp;</span>.&nbsp;<span class="src-var">$token</span><span class="src-sym">-&gt;</span><span class="src-id">key</span><span class="src-sym">,&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../OAuth/SimpleOAuthDataStore.html#var$dbh">dbh</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a769"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$token</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a770"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a771"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a772"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a773"></a><span class="src-key">class&nbsp;</span><a href="../OAuth/OAuthUtil.html">OAuthUtil</a>&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a774"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a775"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;This&nbsp;function&nbsp;takes&nbsp;a&nbsp;input&nbsp;like&nbsp;a=b&amp;a=c&amp;d=e&nbsp;and&nbsp;returns&nbsp;the&nbsp;parsed</span></div></li>
<li><div class="src-line"><a name="a776"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;parameters&nbsp;like&nbsp;this</span></div></li>
<li><div class="src-line"><a name="a777"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;array('a'&nbsp;=&gt;&nbsp;array('b','c'),&nbsp;'d'&nbsp;=&gt;&nbsp;'e')</span></div></li>
<li><div class="src-line"><a name="a778"></a>&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthUtil.html#methodparse_parameters">parse_parameters</a><span class="src-sym">(&nbsp;</span><span class="src-var">$input&nbsp;</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a779"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$input</span><span class="src-sym">)&nbsp;</span>||&nbsp;<span class="src-sym">!</span><span class="src-var">$input</span><span class="src-sym">)&nbsp;</span><span class="src-key">return&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a780"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a781"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$pairs&nbsp;</span>=&nbsp;<a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">'&amp;'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$input</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a782"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a783"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parsed_parameters&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a784"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$pairs&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$pair</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a785"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$split&nbsp;</span>=&nbsp;<a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">'='</span><span class="src-sym">,&nbsp;</span><span class="src-var">$pair</span><span class="src-sym">,&nbsp;</span><span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a786"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parameter&nbsp;</span>=&nbsp;<span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodurldecode_rfc3986">urldecode_rfc3986</a><span class="src-sym">(</span><span class="src-var">$split</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a787"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$value&nbsp;</span>=&nbsp;isset<span class="src-sym">(</span><span class="src-var">$split</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">)&nbsp;</span>?&nbsp;<span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodurldecode_rfc3986">urldecode_rfc3986</a><span class="src-sym">(</span><span class="src-var">$split</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">)&nbsp;</span>:&nbsp;<span class="src-str">''</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a788"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a789"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$parsed_parameters</span><span class="src-sym">[</span><span class="src-var">$parameter</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a790"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;We&nbsp;have&nbsp;already&nbsp;recieved&nbsp;parameter(s)&nbsp;with&nbsp;this&nbsp;name,&nbsp;so&nbsp;add&nbsp;to&nbsp;the&nbsp;list</span></div></li>
<li><div class="src-line"><a name="a791"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;of&nbsp;parameters&nbsp;with&nbsp;this&nbsp;name</span></div></li>
<li><div class="src-line"><a name="a792"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a793"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/is_scalar">is_scalar</a><span class="src-sym">(</span><span class="src-var">$parsed_parameters</span><span class="src-sym">[</span><span class="src-var">$parameter</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a794"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;This&nbsp;is&nbsp;the&nbsp;first&nbsp;duplicate,&nbsp;so&nbsp;transform&nbsp;scalar&nbsp;(string)&nbsp;into&nbsp;an&nbsp;array</span></div></li>
<li><div class="src-line"><a name="a795"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;so&nbsp;we&nbsp;can&nbsp;add&nbsp;the&nbsp;duplicates</span></div></li>
<li><div class="src-line"><a name="a796"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parsed_parameters</span><span class="src-sym">[</span><span class="src-var">$parameter</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$parsed_parameters</span><span class="src-sym">[</span><span class="src-var">$parameter</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a797"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a798"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a799"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parsed_parameters</span><span class="src-sym">[</span><span class="src-var">$parameter</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$value</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a800"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a801"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parsed_parameters</span><span class="src-sym">[</span><span class="src-var">$parameter</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$value</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a802"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a803"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a804"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$parsed_parameters</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a805"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a806"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a807"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;Utility&nbsp;function&nbsp;for&nbsp;turning&nbsp;the&nbsp;Authorization:&nbsp;header&nbsp;into</span></div></li>
<li><div class="src-line"><a name="a808"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;parameters,&nbsp;has&nbsp;to&nbsp;do&nbsp;some&nbsp;unescaping</span></div></li>
<li><div class="src-line"><a name="a809"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;Can&nbsp;filter&nbsp;out&nbsp;any&nbsp;non-oauth&nbsp;parameters&nbsp;if&nbsp;needed&nbsp;(default&nbsp;behaviour)</span></div></li>
<li><div class="src-line"><a name="a810"></a>&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthUtil.html#methodsplit_header">split_header</a><span class="src-sym">(</span><span class="src-var">$header</span><span class="src-sym">,&nbsp;</span><span class="src-var">$only_allow_oauth_parameters&nbsp;</span>=&nbsp;<span class="src-id">true</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a811"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$pattern&nbsp;</span>=&nbsp;<span class="src-str">'/(([-_a-z]*)=(&quot;([^&quot;]*)&quot;|([^,]*)),?)/'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a812"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$offset&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a813"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$params&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a814"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">while&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/preg_match">preg_match</a><span class="src-sym">(</span><span class="src-var">$pattern</span><span class="src-sym">,&nbsp;</span><span class="src-var">$header</span><span class="src-sym">,&nbsp;</span><span class="src-var">$matches</span><span class="src-sym">,&nbsp;</span><span class="src-id">PREG_OFFSET_CAPTURE</span><span class="src-sym">,&nbsp;</span><span class="src-var">$offset</span><span class="src-sym">)&nbsp;</span>&gt;&nbsp;<span class="src-num">0</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a815"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$match&nbsp;</span>=&nbsp;<span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a816"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$header_name&nbsp;</span>=&nbsp;<span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-num">2</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a817"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$header_content&nbsp;</span>=&nbsp;<span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-num">5</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span>?&nbsp;<span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-num">5</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]&nbsp;</span>:&nbsp;<span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-num">4</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a818"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/preg_match">preg_match</a><span class="src-sym">(</span><span class="src-str">'/^oauth_/'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$header_name</span><span class="src-sym">)&nbsp;</span>||&nbsp;<span class="src-sym">!</span><span class="src-var">$only_allow_oauth_parameters</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a819"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$params</span><span class="src-sym">[</span><span class="src-var">$header_name</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodurldecode_rfc3986">urldecode_rfc3986</a><span class="src-sym">(</span><span class="src-var">$header_content</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a820"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a821"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$offset&nbsp;</span>=&nbsp;<span class="src-var">$match</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]&nbsp;</span>+&nbsp;<a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$match</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a822"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a823"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a824"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">[</span><span class="src-str">'realm'</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a825"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unset<span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">[</span><span class="src-str">'realm'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a826"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a827"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a828"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$params</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a829"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a830"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a831"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;helper&nbsp;to&nbsp;try&nbsp;to&nbsp;sort&nbsp;out&nbsp;headers&nbsp;for&nbsp;people&nbsp;who&nbsp;aren't&nbsp;running&nbsp;apache</span></div></li>
<li><div class="src-line"><a name="a832"></a>&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthUtil.html#methodget_headers">get_headers</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a833"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/function_exists">function_exists</a><span class="src-sym">(</span><span class="src-str">'apache_request_headers'</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a834"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;we&nbsp;need&nbsp;this&nbsp;to&nbsp;get&nbsp;the&nbsp;actual&nbsp;Authorization:&nbsp;header</span></div></li>
<li><div class="src-line"><a name="a835"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;because&nbsp;apache&nbsp;tends&nbsp;to&nbsp;tell&nbsp;us&nbsp;it&nbsp;doesn't&nbsp;exist</span></div></li>
<li><div class="src-line"><a name="a836"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">apache_request_headers</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a837"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a838"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;otherwise&nbsp;we&nbsp;don't&nbsp;have&nbsp;apache&nbsp;and&nbsp;are&nbsp;just&nbsp;going&nbsp;to&nbsp;have&nbsp;to&nbsp;hope</span></div></li>
<li><div class="src-line"><a name="a839"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;that&nbsp;$_SERVER&nbsp;actually&nbsp;contains&nbsp;what&nbsp;we&nbsp;need</span></div></li>
<li><div class="src-line"><a name="a840"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$out&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a841"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$_SERVER&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$key&nbsp;</span>=&gt;&nbsp;<span class="src-var">$value</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a842"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$key</span><span class="src-sym">,&nbsp;</span><span class="src-num">0</span><span class="src-sym">,&nbsp;</span><span class="src-num">5</span><span class="src-sym">)&nbsp;</span>==&nbsp;<span class="src-str">&quot;HTTP_&quot;</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a843"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;this&nbsp;is&nbsp;chaos,&nbsp;basically&nbsp;it&nbsp;is&nbsp;just&nbsp;there&nbsp;to&nbsp;capitalize&nbsp;the&nbsp;first</span></div></li>
<li><div class="src-line"><a name="a844"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;letter&nbsp;of&nbsp;every&nbsp;word&nbsp;that&nbsp;is&nbsp;not&nbsp;an&nbsp;initial&nbsp;HTTP&nbsp;and&nbsp;strip&nbsp;HTTP</span></div></li>
<li><div class="src-line"><a name="a845"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;code&nbsp;from&nbsp;przemek</span></div></li>
<li><div class="src-line"><a name="a846"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$key&nbsp;</span>=&nbsp;<a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span></div></li>
<li><div class="src-line"><a name="a847"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">&quot;&nbsp;&quot;</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a848"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">&quot;-&quot;</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a849"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/ucwords">ucwords</a><span class="src-sym">(</span><a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">&quot;_&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;&nbsp;&quot;</span><span class="src-sym">,&nbsp;</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$key</span><span class="src-sym">,&nbsp;</span><span class="src-num">5</span><span class="src-sym">))))</span></div></li>
<li><div class="src-line"><a name="a850"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a851"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$out</span><span class="src-sym">[</span><span class="src-var">$key</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$value</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a852"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a853"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a854"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$out</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a855"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a856"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a857"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a858"></a>&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthUtil.html#methodbuild_http_query">build_http_query</a><span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a859"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$params</span><span class="src-sym">)&nbsp;</span><span class="src-key">return&nbsp;</span><span class="src-str">''</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a860"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a861"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Urlencode&nbsp;both&nbsp;keys&nbsp;and&nbsp;values</span></div></li>
<li><div class="src-line"><a name="a862"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$keys&nbsp;</span>=&nbsp;<span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodurlencode_rfc3986">urlencode_rfc3986</a><span class="src-sym">(</span><a href="http://www.php.net/array_keys">array_keys</a><span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a863"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$values&nbsp;</span>=&nbsp;<span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodurlencode_rfc3986">urlencode_rfc3986</a><span class="src-sym">(</span><a href="http://www.php.net/array_values">array_values</a><span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a864"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$params&nbsp;</span>=&nbsp;<a href="http://www.php.net/array_combine">array_combine</a><span class="src-sym">(</span><span class="src-var">$keys</span><span class="src-sym">,&nbsp;</span><span class="src-var">$values</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a865"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a866"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Parameters&nbsp;are&nbsp;sorted&nbsp;by&nbsp;name,&nbsp;using&nbsp;lexicographical&nbsp;byte&nbsp;value&nbsp;ordering.</span></div></li>
<li><div class="src-line"><a name="a867"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Ref:&nbsp;Spec:&nbsp;9.1.1&nbsp;(1)</span></div></li>
<li><div class="src-line"><a name="a868"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/uksort">uksort</a><span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">,&nbsp;</span><span class="src-str">'strcmp'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a869"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a870"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$pairs&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a871"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$params&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$parameter&nbsp;</span>=&gt;&nbsp;<span class="src-var">$value</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a872"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a873"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;If&nbsp;two&nbsp;or&nbsp;more&nbsp;parameters&nbsp;share&nbsp;the&nbsp;same&nbsp;name,&nbsp;they&nbsp;are&nbsp;sorted&nbsp;by&nbsp;their&nbsp;value</span></div></li>
<li><div class="src-line"><a name="a874"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Ref:&nbsp;Spec:&nbsp;9.1.1&nbsp;(1)</span></div></li>
<li><div class="src-line"><a name="a875"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/natsort">natsort</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a876"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$value&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$duplicate_value</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a877"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$pairs</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$parameter&nbsp;</span>.&nbsp;<span class="src-str">'='&nbsp;</span>.&nbsp;<span class="src-var">$duplicate_value</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a878"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a879"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a880"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$pairs</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$parameter&nbsp;</span>.&nbsp;<span class="src-str">'='&nbsp;</span>.&nbsp;<span class="src-var">$value</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a881"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a882"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a883"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;For&nbsp;each&nbsp;parameter,&nbsp;the&nbsp;name&nbsp;is&nbsp;separated&nbsp;from&nbsp;the&nbsp;corresponding&nbsp;value&nbsp;by&nbsp;an&nbsp;'='&nbsp;character&nbsp;(ASCII&nbsp;code&nbsp;61)</span></div></li>
<li><div class="src-line"><a name="a884"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Each&nbsp;name-value&nbsp;pair&nbsp;is&nbsp;separated&nbsp;by&nbsp;an&nbsp;'&amp;'&nbsp;character&nbsp;(ASCII&nbsp;code&nbsp;38)</span></div></li>
<li><div class="src-line"><a name="a885"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/implode">implode</a><span class="src-sym">(</span><span class="src-str">'&amp;'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$pairs</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a886"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a887"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a888"></a>&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthUtil.html#methodoauth_parse_string">oauth_parse_string</a><span class="src-sym">(</span><span class="src-var">$query_string</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a889"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$query_string</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a890"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a891"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a892"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$pairs&nbsp;</span>=&nbsp;<a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">'&amp;'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$query_string</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a893"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$query_arr&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a894"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$pairs&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$pair</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a895"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list<span class="src-sym">(</span><span class="src-var">$k</span><span class="src-sym">,&nbsp;</span><span class="src-var">$v</span><span class="src-sym">)&nbsp;</span>=&nbsp;<a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">'='</span><span class="src-sym">,&nbsp;</span><span class="src-var">$pair</span><span class="src-sym">,&nbsp;</span><span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a896"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a897"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Handle&nbsp;duplicate&nbsp;query&nbsp;params</span></div></li>
<li><div class="src-line"><a name="a898"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$query_arr</span><span class="src-sym">[</span><span class="src-var">$k</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a899"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a900"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Transform&nbsp;scalar&nbsp;to&nbsp;array</span></div></li>
<li><div class="src-line"><a name="a901"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/is_scalar">is_scalar</a><span class="src-sym">(</span><span class="src-var">$query_arr</span><span class="src-sym">[</span><span class="src-var">$k</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a902"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$query_arr</span><span class="src-sym">[</span><span class="src-var">$k</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$query_arr</span><span class="src-sym">[</span><span class="src-var">$k</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a903"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a904"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$query_arr</span><span class="src-sym">[</span><span class="src-var">$k</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$v</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a905"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a906"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$query_arr</span><span class="src-sym">[</span><span class="src-var">$k</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$v</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a907"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a908"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a909"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$query_arr</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a910"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a911"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a912"></a>&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthUtil.html#methodoauth_http_build_query">oauth_http_build_query</a><span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a913"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a914"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$out&nbsp;</span>=&nbsp;<span class="src-id">false</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a915"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">))</span></div></li>
<li><div class="src-line"><a name="a916"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a917"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Urlencode&nbsp;both&nbsp;keys&nbsp;and&nbsp;values</span></div></li>
<li><div class="src-line"><a name="a918"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$keys&nbsp;</span>=&nbsp;<span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodurlencode_rfc3986">urlencode_rfc3986</a><span class="src-sym">(</span><a href="http://www.php.net/array_keys">array_keys</a><span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a919"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$values&nbsp;</span>=&nbsp;<span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodurlencode_rfc3986">urlencode_rfc3986</a><span class="src-sym">(</span><a href="http://www.php.net/array_values">array_values</a><span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a920"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$params&nbsp;</span>=&nbsp;<a href="http://www.php.net/array_combine">array_combine</a><span class="src-sym">(</span><span class="src-var">$keys</span><span class="src-sym">,&nbsp;</span><span class="src-var">$values</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a921"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a922"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Sort&nbsp;by&nbsp;keys&nbsp;(natsort)</span></div></li>
<li><div class="src-line"><a name="a923"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/uksort">uksort</a><span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">,&nbsp;</span><span class="src-str">'strcmp'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a924"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a925"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$pairs&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a926"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$params&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$k&nbsp;</span>=&gt;&nbsp;<span class="src-var">$v</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a927"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$v</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a928"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/natsort">natsort</a><span class="src-sym">(</span><span class="src-var">$v</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a929"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$v&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$duplicate_value</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a930"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$pairs</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$k&nbsp;</span>.&nbsp;<span class="src-str">'='&nbsp;</span>.&nbsp;<span class="src-var">$duplicate_value</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a931"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a932"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a933"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$pairs</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$k&nbsp;</span>.&nbsp;<span class="src-str">'='&nbsp;</span>.&nbsp;<span class="src-var">$v</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a934"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a935"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a936"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$out&nbsp;</span>=&nbsp;<a href="http://www.php.net/implode">implode</a><span class="src-sym">(</span><span class="src-str">'&amp;'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$pairs</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a937"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a938"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$out</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a939"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a940"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a941"></a>&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthUtil.html#methodurlencode_rfc3986">urlencode_rfc3986</a><span class="src-sym">(</span><span class="src-var">$input</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a942"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$input</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a943"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/array_map">array_map</a><span class="src-sym">(</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'OAuthUtil'</span><span class="src-sym">,</span><span class="src-str">'urlencode_rfc3986'</span><span class="src-sym">)</span><span class="src-sym">,&nbsp;</span><span class="src-var">$input</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a944"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/is_scalar">is_scalar</a><span class="src-sym">(</span><span class="src-var">$input</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a945"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'+'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'&nbsp;'</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a946"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'%7E'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'~'</span><span class="src-sym">,&nbsp;</span><a href="http://www.php.net/rawurlencode">rawurlencode</a><span class="src-sym">(</span><span class="src-var">$input</span><span class="src-sym">)))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a947"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a948"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-str">''</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a949"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a950"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a951"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a952"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;This&nbsp;decode&nbsp;function&nbsp;isn't&nbsp;taking&nbsp;into&nbsp;consideration&nbsp;the&nbsp;above</span></div></li>
<li><div class="src-line"><a name="a953"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;modifications&nbsp;to&nbsp;the&nbsp;encoding&nbsp;process.&nbsp;However,&nbsp;this&nbsp;method&nbsp;doesn't</span></div></li>
<li><div class="src-line"><a name="a954"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;seem&nbsp;to&nbsp;be&nbsp;used&nbsp;anywhere&nbsp;so&nbsp;leaving&nbsp;it&nbsp;as&nbsp;is.</span></div></li>
<li><div class="src-line"><a name="a955"></a>&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthUtil.html#methodurldecode_rfc3986">urldecode_rfc3986</a><span class="src-sym">(</span><span class="src-var">$string</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a956"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/urldecode">urldecode</a><span class="src-sym">(</span><span class="src-var">$string</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a957"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a958"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a959"></a>&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthUtil.html#methodurlencodeRFC3986">urlencodeRFC3986</a><span class="src-sym">(</span><span class="src-var">$input</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a960"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><a href="../OAuth/OAuthUtil.html#methodurlencode_rfc3986">urlencode_rfc3986</a><span class="src-sym">(</span><span class="src-var">$input</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a961"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a962"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a963"></a>&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../OAuth/OAuthUtil.html#methodurldecodeRFC3986">urldecodeRFC3986</a><span class="src-sym">(</span><span class="src-var">$input</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a964"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id"><a href="../OAuth/OAuthUtil.html">OAuthUtil</a></span><span class="src-sym">::</span><span class="src-id">urldecode_rfcC3986</span><span class="src-sym">(</span><span class="src-var">$input</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a965"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a966"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a967"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a968"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a969"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a970"></a><span class="src-doc">&nbsp;*&nbsp;Crib'd&nbsp;native&nbsp;implementation&nbsp;of&nbsp;hash_hmac()&nbsp;for&nbsp;SHA1&nbsp;from&nbsp;the</span></div></li>
<li><div class="src-line"><a name="a971"></a><span class="src-doc">&nbsp;*&nbsp;Fire&nbsp;Eagle&nbsp;PHP&nbsp;code:</span></div></li>
<li><div class="src-line"><a name="a972"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a973"></a><span class="src-doc">&nbsp;*&nbsp;http://fireeagle.yahoo.net/developer/code/php</span></div></li>
<li><div class="src-line"><a name="a974"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a975"></a><span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/function_exists">function_exists</a><span class="src-sym">(</span><span class="src-str">&quot;hash_hmac&quot;</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a976"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Earlier&nbsp;versions&nbsp;of&nbsp;PHP5&nbsp;are&nbsp;missing&nbsp;hash_hmac().&nbsp;&nbsp;Here's&nbsp;a</span></div></li>
<li><div class="src-line"><a name="a977"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;pure-PHP&nbsp;version&nbsp;in&nbsp;case&nbsp;you're&nbsp;using&nbsp;one&nbsp;of&nbsp;them.</span></div></li>
<li><div class="src-line"><a name="a978"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../OAuth/_OAuth.php.html#functionhash_hmac">hash_hmac</a><span class="src-sym">(</span><span class="src-var">$algo</span><span class="src-sym">,&nbsp;</span><span class="src-var">$data</span><span class="src-sym">,&nbsp;</span><span class="src-var">$key</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a979"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Thanks,&nbsp;Kellan:&nbsp;http://laughingmeme.org/code/hmacsha1.php.txt</span></div></li>
<li><div class="src-line"><a name="a980"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$algo&nbsp;</span>!=&nbsp;<span class="src-str">'sha1'</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a981"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/trigger_error">trigger_error</a><span class="src-sym">(</span><span class="src-str">&quot;Internal&nbsp;hash_hmac()&nbsp;can&nbsp;only&nbsp;do&nbsp;sha1,&nbsp;sorry&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-id">E_USER_WARNING</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a982"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a983"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a984"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a985"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$blocksize&nbsp;</span>=&nbsp;<span class="src-num">64</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a986"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$hashfunc&nbsp;</span>=&nbsp;<span class="src-str">'sha1'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a987"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$key</span><span class="src-sym">)</span>&gt;<span class="src-var">$blocksize</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a988"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$key&nbsp;</span>=&nbsp;<a href="http://www.php.net/pack">pack</a><span class="src-sym">(</span><span class="src-str">'H*'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$hashfunc</span><span class="src-sym">(</span><span class="src-var">$key</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a989"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$key&nbsp;</span>=&nbsp;<a href="http://www.php.net/str_pad">str_pad</a><span class="src-sym">(</span><span class="src-var">$key</span><span class="src-sym">,</span><span class="src-var">$blocksize</span><span class="src-sym">,</span><a href="http://www.php.net/chr">chr</a><span class="src-sym">(</span><span class="src-num">0x00</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a990"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$ipad&nbsp;</span>=&nbsp;<a href="http://www.php.net/str_repeat">str_repeat</a><span class="src-sym">(</span><a href="http://www.php.net/chr">chr</a><span class="src-sym">(</span><span class="src-num">0x36</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$blocksize</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a991"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$opad&nbsp;</span>=&nbsp;<a href="http://www.php.net/str_repeat">str_repeat</a><span class="src-sym">(</span><a href="http://www.php.net/chr">chr</a><span class="src-sym">(</span><span class="src-num">0x5c</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$blocksize</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a992"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$hmac&nbsp;</span>=&nbsp;<a href="http://www.php.net/pack">pack</a><span class="src-sym">(</span></div></li>
<li><div class="src-line"><a name="a993"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">'H*'</span><span class="src-sym">,</span><span class="src-var">$hashfunc</span><span class="src-sym">(</span></div></li>
<li><div class="src-line"><a name="a994"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(</span><span class="src-var">$key</span>^<span class="src-var">$opad</span><span class="src-sym">)</span>.<a href="http://www.php.net/pack">pack</a><span class="src-sym">(</span></div></li>
<li><div class="src-line"><a name="a995"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">'H*'</span><span class="src-sym">,</span><span class="src-var">$hashfunc</span><span class="src-sym">(</span></div></li>
<li><div class="src-line"><a name="a996"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(</span><span class="src-var">$key</span>^<span class="src-var">$ipad</span><span class="src-sym">)</span>.<span class="src-var">$data</span></div></li>
<li><div class="src-line"><a name="a997"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a998"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a999"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a1000"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1001"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$hmac</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1002"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1003"></a><span class="src-sym">}</span></div></li>
</ol></div>
</div>
	<p class="notes" id="credit">
		Documentation generated on Thu, 22 Oct 2009 12:54:45 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.3</a>
	</p>
	</body>
</html>